package com.airnewslinkosky.ticket.adapter;

import java.util.List;
import java.util.Map;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleExpandableListAdapter;
import android.widget.TextView;

import com.airnewslinkosky.ticket.R;
/**
 * 可伸展的大客户管理列表效果
 * @author toshiba
 *
 */
public class ClientListViewExpandAdapter extends SimpleExpandableListAdapter  {
	LayoutInflater layoutInflater ;
	List<Map<String, Object>> parentList;
	List<List<Map<String, Object>>> allChildList;
	Context context;

	public ClientListViewExpandAdapter(Context context,List<Map<String, Object>> parentList, List<List<Map<String, Object>>> allChildList) { 
		super(context, parentList, 0, 0, null, null, allChildList, 0, 0, null, null);  
		this.context = context;
		this.parentList = parentList;
		this.allChildList = allChildList;
		this.layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		System.out.println("3333333333333333333333333333");
	}  
	
	@Override
	public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {  
		   ViewHolder holder; 
		   //得到自己定义的List的界面
		  if (convertView == null) { 
			  convertView = this.layoutInflater.inflate(R.layout.client_row, null); 
			  holder = new ViewHolder(); 
			  holder.clientNo = (TextView) convertView.findViewById(R.id.clientNo); 
			  holder.clientName = (TextView) convertView.findViewById(R.id.clientName); 
			  
			  convertView.setTag(holder); 
		  } else {
			  holder = (ViewHolder) convertView.getTag(); 
		  }
		  
//		  holder.clientNo.setText(this.parentList.get(groupPosition).get("clientNo").toString());
//		  holder.clientName.setText(this.parentList.get(groupPosition).get("clientName").toString());
//		  holder.clientStatus.setText(this.parentList.get(groupPosition).get("clientStatus").toString());
//		  holder.clientDate.setText(this.parentList.get(groupPosition).get("clientDate").toString());
		  
		  holder.clientNo.setText("23423423");
		  holder.clientName.setText("联东伟业");
		  holder.clientStatus.setText("启用");
		  holder.clientDate.setText("2011-10-02");
		  System.out.println("getGroupViewgetGroupViewgetGroupViewgetGroupViewgetGroupView");
		  return convertView;
	}
	
    
	@Override  
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {  
		ViewHolder holder; 
		 //得到自己定义的List的界面
		  if (convertView == null) { 
			  convertView = this.layoutInflater.inflate(R.layout.fly_row_more, null); 
			  holder = new ViewHolder(); 
			  //更多的价钱项
			  convertView.setTag(holder); 
		  } else {
			  holder = (ViewHolder) convertView.getTag(); 
		  }
		  return convertView;
	}  

	static class ViewHolder { 
		TextView clientNo,clientName,clientStatus,clientDate; 
	} 


}
